package cn.itlaobing.eshop.web.servlet;

import cn.itlaobing.eshop.entity.GoodsDTO;
import cn.itlaobing.eshop.entity.ItlbFocuss;
import cn.itlaobing.eshop.exception.BusinessExceeption;
import cn.itlaobing.eshop.service.FocusService;
import cn.itlaobing.eshop.service.GoodsService;
import cn.itlaobing.eshop.web.annotation.RequestMapping;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Created by Administrator on 2017/11/13.
 */
@WebServlet("/home/*")
public class HomeServlet extends BaseServlet {
    @RequestMapping("/show")
    public void login(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        FocusService fs=new FocusService();
        GoodsService gs=new GoodsService();
        try {
            List<ItlbFocuss> list=fs.query();
            req.setAttribute("FOCUS_IMGURL",list);
            List<GoodsDTO> list1=gs.queryHotGoods();
            req.setAttribute("HOT_GOODS",list1);
        } catch (BusinessExceeption businessExceeption) {
            businessExceeption.printStackTrace();
        }
        req.getRequestDispatcher("/WEB-INF/views/index.jsp").forward(req,resp);

    }

}
